from django.db import models

# Create your models here.
class Textbook(models.Model):
    isbn = models.CharField("ISBN", max_length=20, primary_key=True)
    name = models.CharField("教材名", max_length=100)
    description = models.TextField("简介", blank=True)


# 教材领取申请
class TextbookRequest(models.Model):
    course = models.ForeignKey('courseapp.Course', on_delete=models.CASCADE)
    teacher = models.ForeignKey('teacherapp.Teacher', on_delete=models.CASCADE)
    textbook = models.ForeignKey(Textbook, on_delete=models.CASCADE)
    quantity = models.IntegerField("教材数量")
    receive_time = models.DateTimeField("预约领取时间")
    STATUS_CHOICES = [("pending", "待审核"), ("approved", "通过"), ("rejected", "拒绝")]
    status = models.CharField("状态", max_length=10, choices=STATUS_CHOICES, default="pending")
